"""
简化的性能测试 - 验证导入和基本功能
"""

import sys
import os
import time

# 添加项目根目录到Python路径
project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.insert(0, project_root)

print(f"项目根目录: {project_root}")
print(f"Python路径: {sys.path[:3]}")

try:
    from app.models.brain_wave_data import BrainWaveData, TimeSeriesData, FrequencyData
    print("✓ 成功导入 brain_wave_data 模块")
except ImportError as e:
    print(f"✗ 导入 brain_wave_data 失败: {e}")
    sys.exit(1)

try:
    from app.core.mne_processor import MNEProcessor
    print("✓ 成功导入 MNEProcessor")
except ImportError as e:
    print(f"✗ 导入 MNEProcessor 失败: {e}")

try:
    from app.core.yasa_analyzer import YASAAnalyzer
    print("✓ 成功导入 YASAAnalyzer")
except ImportError as e:
    print(f"✗ 导入 YASAAnalyzer 失败: {e}")

print("\n开始简化测试...")

# 测试基本功能
import numpy as np
from datetime import datetime

# 生成少量测试数据
print("生成测试数据...")
test_data = np.random.randn(512)  # 1秒的数据
timestamp = datetime.now()

time_series = TimeSeriesData(
    data=test_data,
    sampling_rate=512,
    timestamp=timestamp,
    channel_names=['EEG'],
    duration=1.0
)

frequency_data = FrequencyData(
    delta=0.3, theta=0.2, low_alpha=0.15, high_alpha=0.1,
    low_beta=0.1, high_beta=0.05, low_gamma=0.05, mid_gamma=0.05,
    attention=50, meditation=40, poor_signal=10, blink_strength=20,
    timestamp=timestamp
)

brain_wave_data = BrainWaveData(
    time_series=time_series,
    frequency_data=frequency_data,
    session_id="test_session",
    room_id="test_room",
    processing_stage="raw"
)

print("✓ 成功创建测试数据对象")
print(f"数据长度: {len(brain_wave_data.time_series.data)}")
print(f"采样率: {brain_wave_data.time_series.sampling_rate}")

print("\n简化测试完成！")